// Xampler, a MIDI-driven sampler
// Copyright (C) 2006 Nick Thomas
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
// 02110-1301 USA.

#include "MenuBar.hpp"
#include <gtkmm/stock.h>
using namespace xampler;

MenuBar::MenuBar()
{
    m_action_group = Gtk::ActionGroup::create();

    // File menu
    m_action_group->add(Gtk::Action::create("MenuFile", "_File"));
    m_action_group->add(Gtk::Action::create("New", Gtk::Stock::NEW));
    m_action_group->add(Gtk::Action::create("Open", Gtk::Stock::OPEN));
    m_action_group->add(Gtk::Action::create("Revert",
                                            Gtk::Stock::REVERT_TO_SAVED));
    m_action_group->add(Gtk::Action::create("Save", Gtk::Stock::SAVE));
    m_action_group->add(Gtk::Action::create("SaveAs", Gtk::Stock::SAVE_AS));
    m_action_group->add(Gtk::Action::create("Quit", Gtk::Stock::QUIT));

    // Help menu
    m_action_group->add(Gtk::Action::create("MenuHelp", "_Help"));
    m_action_group->add(Gtk::Action::create("About", Gtk::Stock::ABOUT));

    Glib::ustring ui_info =
        "<ui>"
        "  <menubar name='MenuBar'>"
        "    <menu action='MenuFile'>"
        "      <menuitem action='New'/>"
        "      <menuitem action='Open'/>"
        "      <menuitem action='Revert'/>"
        "      <menuitem action='Save'/>"
        "      <menuitem action='SaveAs'/>"
        "      <menuitem action='Quit'/>"
        "    </menu>"
        "    <menu action='MenuHelp'>"
        "      <menuitem action='About'/>"
        "    </menu>"
        "  </menubar>"
        "</ui>";

    m_ui_manager = Gtk::UIManager::create();
    m_ui_manager->insert_action_group(m_action_group);
    m_ui_manager->add_ui_from_string(ui_info);
}
